package br.inf.solutions.apresentacoes.ssp.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import br.com.vexillum.model.annotations.Validate;
import br.com.vexillum.model.annotations.ValidatorClass;
import br.inf.solutions.apresentacoes.ssp.model.basics.BasicCommon;

@Entity
@SuppressWarnings("serial")
@ValidatorClass(validatorClass="br.inf.solutions.apresentacoes.ssp.control.validator.SubSquareValidator")
public class SubSquare extends BasicCommon {
 
	@Column(nullable=false)
	@Validate(notNull=true)
	private String acronym;

	@Validate(notNull=true)
	@ManyToOne(optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "square_id", insertable = true, updatable = true, nullable=false)
	private Square square;
	
	public String getAcronym() {
		return acronym;
	}

	public void setAcronym(String acronym) {
		if (acronym != null)
		{
			acronym = acronym.toUpperCase();
		}
		this.acronym = acronym;
	}

	public Square getSquare() {
		return square;
	}

	public void setSquare(Square square) {
		this.square = square;
	}
	 

	
}
 
